/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session05;

import java.util.Iterator;
import java.util.LinkedHashSet;
import session04.Student;

/**
 *
 * @author macbookpro
 */
public class LinkedHashSetTest {
    public static void main(String[] args) {
        LinkedHashSet lhs = new LinkedHashSet();
        
        lhs.add(new Student("R00004", "aaaa"));
        lhs.add(new Student("R00001", "bbbb"));
        lhs.add(new Student("R00005", "xxxx"));
        lhs.add(new Student("R00002", "cccc"));
        
        //Khong nen su dung for
        for(Object obj : lhs){
            System.out.println(obj);
        }
        
        //Nen su dung voi Iterator
        Iterator i = lhs.iterator();
        while (i.hasNext()) {
            System.out.println(i.next());
        }
    }
}
